<%-- 
    Document   : admin
    Created on : Nov 5, 2009, 11:07:57 PM
    Author     : moustafa
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<%@page import="java.util.ArrayList" %>
<%@page import="java.util.Iterator" %>
<%@page import="model.Inventory" %>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
   "http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <title>Administrator Page</title>
    </head>
    <body>
        <form action="admin/warehouses">
            <input type="submit" value="Warehouses" />
        </form>

        <form action="admin/inventories">
            <input type="submit" value="Inventories" />
        </form>

        <form action="admin/products">
            <input type="submit" value="Products" />
        </form>

        <table border="1" cellspacing="1" cellpadding="1">
            <thead>
                <tr>
                    <th>Warehouse</th>
                    <th>Product</th>
                    <th>Quantity</th>
                    <th>Supplementary Inventories</th>
                </tr>
            </thead>
            <tbody>
                <tr>
                    <td></td>
                </tr>
                <%
                
                    ArrayList<Inventory> defficientInvs = (ArrayList<Inventory>)request.getSession().getAttribute("defficiencies");
                    //javax.swing.JOptionPane.showMessageDialog(new javax.swing.JFrame("Message"), defficientInvs);
                    Iterator<Inventory> deffItr = defficientInvs.iterator();
                    int index = 0;
                    while(deffItr.hasNext()){
                        Inventory deffInv = deffItr.next();

                %>
                <%=
                "<tr>"+
                    "<td>" + deffInv.getWarehouse().getName() + "</td>"+
                    "<td>" + deffInv.getProduct().getName() + "</td>"+
                    "<td>" + deffInv.getQuantity() + "</td>"+
                    "<td>" +
                     "<form action='admin/supplementinv'>" +
                        "<input type='hidden' name='deff_index' value='" + index + "'/>" +
                        "<input type='submit' value='Supplement' />" +
                     "</form>" +
                    "</td>"+
                "</tr>"
                %>
                <%
                    index++;
                    }
                %>
            </tbody>
        </table>


    </body>
</html>
